﻿import { Component ,OnInit} from '@angular/core';
import { AppServiceMembership } from './services/app.service.membership';
import { Router } from '@angular/router';

@Component({
    selector: 'my-app',
    templateUrl:'./app/app.component.html'
})
export class AppComponent implements OnInit {
    username: string;
    isLogin: boolean;
    constructor(private appServiceMembership: AppServiceMembership, private router: Router) {

    }
    showUserInfo(event) {
        console.log('event:' + event.value);
        if (event) {
            this.username = event.value;
        }
    }
    isAuthenticated() {
        if (!this.appServiceMembership.isUserLoggedIn()) {
           
            this.isLogin = false;
        } else {
            this.isLogin = true;
        }
    }

    displayUserInfo() {
        this.username = this.appServiceMembership.repository.loggedUser.username;
    }
    ngOnInit() {
        this.isAuthenticated();      
    }
}
